3.2.21 \(\int f^{a+c x^2} \cos ^3(d+f x^2) \, dx\) [121]

3.2.21.1 Optimal result
3.2.21.2 Mathematica [A] (verified)
3.2.21.3 Rubi [A] (verified)
3.2.21.4 Maple [A] (verified)
3.2.21.5 Fricas [B] (verification not implemented)
3.2.21.6 Sympy [F]
3.2.21.7 Maxima [B] (verification not implemented)
3.2.21.8 Giac [F]
3.2.21.9 Mupad [F(-1)]

3.2.21.1 Optimal result

Integrand size = 20, antiderivative size = 205 \[ \int f^{a+c x^2} \cos ^3\left (d+f x^2\right ) \, dx=\frac {3 e^{-i d} f^a \sqrt {\pi } \text {erf}\left (x \sqrt {i f-c \log (f)}\right )}{16 \sqrt {i f-c \log (f)}}+\frac {e^{-3 i d} f^a \sqrt {\pi } \text {erf}\left (x \sqrt {3 i f-c \log (f)}\right )}{16 \sqrt {3 i f-c \log (f)}}+\frac {3 e^{i d} f^a \sqrt {\pi } \text {erfi}\left (x \sqrt {i f+c \log (f)}\right )}{16 \sqrt {i f+c \log (f)}}+\frac {e^{3 i d} f^a \sqrt {\pi } \text {erfi}\left (x \sqrt {3 i f+c \log (f)}\right )}{16 \sqrt {3 i f+c \log (f)}} \]

output
3/16*f^a*erf(x*(I*f-c*ln(f))^(1/2))*Pi^(1/2)/exp(I*d)/(I*f-c*ln(f))^(1/2)+ 
1/16*f^a*erf(x*(3*I*f-c*ln(f))^(1/2))*Pi^(1/2)/exp(3*I*d)/(3*I*f-c*ln(f))^ 
(1/2)+3/16*exp(I*d)*f^a*erfi(x*(I*f+c*ln(f))^(1/2))*Pi^(1/2)/(I*f+c*ln(f)) 
^(1/2)+1/16*exp(3*I*d)*f^a*erfi(x*(3*I*f+c*ln(f))^(1/2))*Pi^(1/2)/(3*I*f+c 
*ln(f))^(1/2)
 
3.2.21.2 Mathematica [A] (verified)

Time = 1.65 (sec) , antiderivative size = 389, normalized size of antiderivative = 1.90 \[ \int f^{a+c x^2} \cos ^3\left (d+f x^2\right ) \, dx=\frac {\sqrt [4]{-1} f^a \sqrt {\pi } \left (3 \text {erfi}\left (\sqrt [4]{-1} x \sqrt {f-i c \log (f)}\right ) \sqrt {f-i c \log (f)} \left (-9 i f^3+9 c f^2 \log (f)-i c^2 f \log ^2(f)+c^3 \log ^3(f)\right ) (\cos (d)+i \sin (d))+(f-i c \log (f)) \left (-\left ((3 f-i c \log (f)) \left (9 f \text {erf}\left (\frac {(1+i) x \sqrt {f+i c \log (f)}}{\sqrt {2}}\right ) \sqrt {f+i c \log (f)} \sin (d)+3 \text {erfi}\left ((-1)^{3/4} x \sqrt {f+i c \log (f)}\right ) \sqrt {f+i c \log (f)} (\cos (d) (3 f+i c \log (f))+c \log (f) \sin (d))+\text {erfi}\left ((-1)^{3/4} x \sqrt {3 f+i c \log (f)}\right ) (f+i c \log (f)) \sqrt {3 f+i c \log (f)} (\cos (3 d)-i \sin (3 d))\right )\right )+\text {erfi}\left (\sqrt [4]{-1} x \sqrt {3 f-i c \log (f)}\right ) \sqrt {3 f-i c \log (f)} \left (-3 i f^2+4 c f \log (f)+i c^2 \log ^2(f)\right ) (\cos (3 d)+i \sin (3 d))\right )\right )}{16 \left (9 f^4+10 c^2 f^2 \log ^2(f)+c^4 \log ^4(f)\right )} \]

input
Integrate[f^(a + c*x^2)*Cos[d + f*x^2]^3,x]
 
output
((-1)^(1/4)*f^a*Sqrt[Pi]*(3*Erfi[(-1)^(1/4)*x*Sqrt[f - I*c*Log[f]]]*Sqrt[f 
 - I*c*Log[f]]*((-9*I)*f^3 + 9*c*f^2*Log[f] - I*c^2*f*Log[f]^2 + c^3*Log[f 
]^3)*(Cos[d] + I*Sin[d]) + (f - I*c*Log[f])*(-((3*f - I*c*Log[f])*(9*f*Erf 
[((1 + I)*x*Sqrt[f + I*c*Log[f]])/Sqrt[2]]*Sqrt[f + I*c*Log[f]]*Sin[d] + 3 
*Erfi[(-1)^(3/4)*x*Sqrt[f + I*c*Log[f]]]*Sqrt[f + I*c*Log[f]]*(Cos[d]*(3*f 
 + I*c*Log[f]) + c*Log[f]*Sin[d]) + Erfi[(-1)^(3/4)*x*Sqrt[3*f + I*c*Log[f 
]]]*(f + I*c*Log[f])*Sqrt[3*f + I*c*Log[f]]*(Cos[3*d] - I*Sin[3*d]))) + Er 
fi[(-1)^(1/4)*x*Sqrt[3*f - I*c*Log[f]]]*Sqrt[3*f - I*c*Log[f]]*((-3*I)*f^2 
 + 4*c*f*Log[f] + I*c^2*Log[f]^2)*(Cos[3*d] + I*Sin[3*d]))))/(16*(9*f^4 + 
10*c^2*f^2*Log[f]^2 + c^4*Log[f]^4))
 
3.2.21.3 Rubi [A] (verified)

Time = 0.51 (sec) , antiderivative size = 205, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.100, Rules used = {4976, 2009}

Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.

\(\displaystyle \int f^{a+c x^2} \cos ^3\left (d+f x^2\right ) \, dx\)

\(\Big \downarrow \) 4976

\(\displaystyle \int \left (\frac {3}{8} e^{-i d-i f x^2} f^{a+c x^2}+\frac {3}{8} e^{i d+i f x^2} f^{a+c x^2}+\frac {1}{8} e^{-3 i d-3 i f x^2} f^{a+c x^2}+\frac {1}{8} e^{3 i d+3 i f x^2} f^{a+c x^2}\right )dx\)

\(\Big \downarrow \) 2009

\(\displaystyle \frac {3 \sqrt {\pi } e^{-i d} f^a \text {erf}\left (x \sqrt {-c \log (f)+i f}\right )}{16 \sqrt {-c \log (f)+i f}}+\frac {\sqrt {\pi } e^{-3 i d} f^a \text {erf}\left (x \sqrt {-c \log (f)+3 i f}\right )}{16 \sqrt {-c \log (f)+3 i f}}+\frac {3 \sqrt {\pi } e^{i d} f^a \text {erfi}\left (x \sqrt {c \log (f)+i f}\right )}{16 \sqrt {c \log (f)+i f}}+\frac {\sqrt {\pi } e^{3 i d} f^a \text {erfi}\left (x \sqrt {c \log (f)+3 i f}\right )}{16 \sqrt {c \log (f)+3 i f}}\)

input
Int[f^(a + c*x^2)*Cos[d + f*x^2]^3,x]
 
output
(3*f^a*Sqrt[Pi]*Erf[x*Sqrt[I*f - c*Log[f]]])/(16*E^(I*d)*Sqrt[I*f - c*Log[ 
f]]) + (f^a*Sqrt[Pi]*Erf[x*Sqrt[(3*I)*f - c*Log[f]]])/(16*E^((3*I)*d)*Sqrt 
[(3*I)*f - c*Log[f]]) + (3*E^(I*d)*f^a*Sqrt[Pi]*Erfi[x*Sqrt[I*f + c*Log[f] 
]])/(16*Sqrt[I*f + c*Log[f]]) + (E^((3*I)*d)*f^a*Sqrt[Pi]*Erfi[x*Sqrt[(3*I 
)*f + c*Log[f]]])/(16*Sqrt[(3*I)*f + c*Log[f]])
 

3.2.21.3.1 Defintions of rubi rules used

rule 2009
Int[u_, x_Symbol] :> Simp[IntSum[u, x], x] /; SumQ[u]
 

rule 4976
Int[Cos[v_]^(n_.)*(F_)^(u_), x_Symbol] :> Int[ExpandTrigToExp[F^u, Cos[v]^n 
, x], x] /; FreeQ[F, x] && (LinearQ[u, x] || PolyQ[u, x, 2]) && (LinearQ[v, 
 x] || PolyQ[v, x, 2]) && IGtQ[n, 0]
 
3.2.21.4 Maple [A] (verified)

Time = 1.35 (sec) , antiderivative size = 162, normalized size of antiderivative = 0.79

method result size
risch \(\frac {\sqrt {\pi }\, f^{a} {\mathrm e}^{-3 i d} \operatorname {erf}\left (x \sqrt {3 i f -c \ln \left (f \right )}\right )}{16 \sqrt {3 i f -c \ln \left (f \right )}}+\frac {3 \sqrt {\pi }\, f^{a} {\mathrm e}^{-i d} \operatorname {erf}\left (x \sqrt {i f -c \ln \left (f \right )}\right )}{16 \sqrt {i f -c \ln \left (f \right )}}+\frac {3 \sqrt {\pi }\, f^{a} {\mathrm e}^{i d} \operatorname {erf}\left (\sqrt {-c \ln \left (f \right )-i f}\, x \right )}{16 \sqrt {-c \ln \left (f \right )-i f}}+\frac {\sqrt {\pi }\, f^{a} {\mathrm e}^{3 i d} \operatorname {erf}\left (\sqrt {-c \ln \left (f \right )-3 i f}\, x \right )}{16 \sqrt {-c \ln \left (f \right )-3 i f}}\) \(162\)

input
int(f^(c*x^2+a)*cos(f*x^2+d)^3,x,method=_RETURNVERBOSE)
 
output
1/16*Pi^(1/2)*f^a*exp(-3*I*d)/(3*I*f-c*ln(f))^(1/2)*erf(x*(3*I*f-c*ln(f))^ 
(1/2))+3/16*Pi^(1/2)*f^a*exp(-I*d)/(I*f-c*ln(f))^(1/2)*erf(x*(I*f-c*ln(f)) 
^(1/2))+3/16*Pi^(1/2)*f^a*exp(I*d)/(-c*ln(f)-I*f)^(1/2)*erf((-c*ln(f)-I*f) 
^(1/2)*x)+1/16*Pi^(1/2)*f^a*exp(3*I*d)/(-c*ln(f)-3*I*f)^(1/2)*erf((-c*ln(f 
)-3*I*f)^(1/2)*x)
 
3.2.21.5 Fricas [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 311 vs. \(2 (145) = 290\).

Time = 0.26 (sec) , antiderivative size = 311, normalized size of antiderivative = 1.52 \[ \int f^{a+c x^2} \cos ^3\left (d+f x^2\right ) \, dx=-\frac {\sqrt {\pi } {\left (c^{3} \log \left (f\right )^{3} - 3 i \, c^{2} f \log \left (f\right )^{2} + c f^{2} \log \left (f\right ) - 3 i \, f^{3}\right )} \sqrt {-c \log \left (f\right ) - 3 i \, f} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) - 3 i \, f} x\right ) e^{\left (a \log \left (f\right ) + 3 i \, d\right )} + 3 \, \sqrt {\pi } {\left (c^{3} \log \left (f\right )^{3} - i \, c^{2} f \log \left (f\right )^{2} + 9 \, c f^{2} \log \left (f\right ) - 9 i \, f^{3}\right )} \sqrt {-c \log \left (f\right ) - i \, f} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) - i \, f} x\right ) e^{\left (a \log \left (f\right ) + i \, d\right )} + 3 \, \sqrt {\pi } {\left (c^{3} \log \left (f\right )^{3} + i \, c^{2} f \log \left (f\right )^{2} + 9 \, c f^{2} \log \left (f\right ) + 9 i \, f^{3}\right )} \sqrt {-c \log \left (f\right ) + i \, f} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) + i \, f} x\right ) e^{\left (a \log \left (f\right ) - i \, d\right )} + \sqrt {\pi } {\left (c^{3} \log \left (f\right )^{3} + 3 i \, c^{2} f \log \left (f\right )^{2} + c f^{2} \log \left (f\right ) + 3 i \, f^{3}\right )} \sqrt {-c \log \left (f\right ) + 3 i \, f} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) + 3 i \, f} x\right ) e^{\left (a \log \left (f\right ) - 3 i \, d\right )}}{16 \, {\left (c^{4} \log \left (f\right )^{4} + 10 \, c^{2} f^{2} \log \left (f\right )^{2} + 9 \, f^{4}\right )}} \]

input
integrate(f^(c*x^2+a)*cos(f*x^2+d)^3,x, algorithm="fricas")
 
output
-1/16*(sqrt(pi)*(c^3*log(f)^3 - 3*I*c^2*f*log(f)^2 + c*f^2*log(f) - 3*I*f^ 
3)*sqrt(-c*log(f) - 3*I*f)*erf(sqrt(-c*log(f) - 3*I*f)*x)*e^(a*log(f) + 3* 
I*d) + 3*sqrt(pi)*(c^3*log(f)^3 - I*c^2*f*log(f)^2 + 9*c*f^2*log(f) - 9*I* 
f^3)*sqrt(-c*log(f) - I*f)*erf(sqrt(-c*log(f) - I*f)*x)*e^(a*log(f) + I*d) 
 + 3*sqrt(pi)*(c^3*log(f)^3 + I*c^2*f*log(f)^2 + 9*c*f^2*log(f) + 9*I*f^3) 
*sqrt(-c*log(f) + I*f)*erf(sqrt(-c*log(f) + I*f)*x)*e^(a*log(f) - I*d) + s 
qrt(pi)*(c^3*log(f)^3 + 3*I*c^2*f*log(f)^2 + c*f^2*log(f) + 3*I*f^3)*sqrt( 
-c*log(f) + 3*I*f)*erf(sqrt(-c*log(f) + 3*I*f)*x)*e^(a*log(f) - 3*I*d))/(c 
^4*log(f)^4 + 10*c^2*f^2*log(f)^2 + 9*f^4)
 
3.2.21.6 Sympy [F]

\[ \int f^{a+c x^2} \cos ^3\left (d+f x^2\right ) \, dx=\int f^{a + c x^{2}} \cos ^{3}{\left (d + f x^{2} \right )}\, dx \]

input
integrate(f**(c*x**2+a)*cos(f*x**2+d)**3,x)
 
output
Integral(f**(a + c*x**2)*cos(d + f*x**2)**3, x)
 
3.2.21.7 Maxima [B] (verification not implemented)

Both result and optimal contain complex but leaf count of result is larger than twice the leaf count of optimal. 667 vs. \(2 (145) = 290\).

Time = 0.25 (sec) , antiderivative size = 667, normalized size of antiderivative = 3.25 \[ \int f^{a+c x^2} \cos ^3\left (d+f x^2\right ) \, dx=\frac {\sqrt {\pi } \sqrt {2 \, c^{2} \log \left (f\right )^{2} + 18 \, f^{2}} {\left ({\left ({\left (-i \, c^{2} \cos \left (3 \, d\right ) - c^{2} \sin \left (3 \, d\right )\right )} f^{a} \log \left (f\right )^{2} + f^{a + 2} {\left (-i \, \cos \left (3 \, d\right ) - \sin \left (3 \, d\right )\right )}\right )} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) + 3 i \, f} x\right ) + {\left ({\left (i \, c^{2} \cos \left (3 \, d\right ) - c^{2} \sin \left (3 \, d\right )\right )} f^{a} \log \left (f\right )^{2} + f^{a + 2} {\left (i \, \cos \left (3 \, d\right ) - \sin \left (3 \, d\right )\right )}\right )} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) - 3 i \, f} x\right )\right )} \sqrt {c \log \left (f\right ) + \sqrt {c^{2} \log \left (f\right )^{2} + 9 \, f^{2}}} + 3 \, \sqrt {\pi } \sqrt {2 \, c^{2} \log \left (f\right )^{2} + 2 \, f^{2}} {\left ({\left ({\left (-i \, c^{2} \cos \left (d\right ) - c^{2} \sin \left (d\right )\right )} f^{a} \log \left (f\right )^{2} + 9 \, f^{a + 2} {\left (-i \, \cos \left (d\right ) - \sin \left (d\right )\right )}\right )} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) + i \, f} x\right ) + {\left ({\left (i \, c^{2} \cos \left (d\right ) - c^{2} \sin \left (d\right )\right )} f^{a} \log \left (f\right )^{2} + 9 \, f^{a + 2} {\left (i \, \cos \left (d\right ) - \sin \left (d\right )\right )}\right )} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) - i \, f} x\right )\right )} \sqrt {c \log \left (f\right ) + \sqrt {c^{2} \log \left (f\right )^{2} + f^{2}}} + \sqrt {\pi } \sqrt {2 \, c^{2} \log \left (f\right )^{2} + 18 \, f^{2}} {\left ({\left ({\left (c^{2} \cos \left (3 \, d\right ) - i \, c^{2} \sin \left (3 \, d\right )\right )} f^{a} \log \left (f\right )^{2} + f^{a + 2} {\left (\cos \left (3 \, d\right ) - i \, \sin \left (3 \, d\right )\right )}\right )} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) + 3 i \, f} x\right ) + {\left ({\left (c^{2} \cos \left (3 \, d\right ) + i \, c^{2} \sin \left (3 \, d\right )\right )} f^{a} \log \left (f\right )^{2} + f^{a + 2} {\left (\cos \left (3 \, d\right ) + i \, \sin \left (3 \, d\right )\right )}\right )} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) - 3 i \, f} x\right )\right )} \sqrt {-c \log \left (f\right ) + \sqrt {c^{2} \log \left (f\right )^{2} + 9 \, f^{2}}} + 3 \, \sqrt {\pi } \sqrt {2 \, c^{2} \log \left (f\right )^{2} + 2 \, f^{2}} {\left ({\left ({\left (c^{2} \cos \left (d\right ) - i \, c^{2} \sin \left (d\right )\right )} f^{a} \log \left (f\right )^{2} + 9 \, f^{a + 2} {\left (\cos \left (d\right ) - i \, \sin \left (d\right )\right )}\right )} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) + i \, f} x\right ) + {\left ({\left (c^{2} \cos \left (d\right ) + i \, c^{2} \sin \left (d\right )\right )} f^{a} \log \left (f\right )^{2} + 9 \, f^{a + 2} {\left (\cos \left (d\right ) + i \, \sin \left (d\right )\right )}\right )} \operatorname {erf}\left (\sqrt {-c \log \left (f\right ) - i \, f} x\right )\right )} \sqrt {-c \log \left (f\right ) + \sqrt {c^{2} \log \left (f\right )^{2} + f^{2}}}}{32 \, {\left (c^{4} \log \left (f\right )^{4} + 10 \, c^{2} f^{2} \log \left (f\right )^{2} + 9 \, f^{4}\right )}} \]

input
integrate(f^(c*x^2+a)*cos(f*x^2+d)^3,x, algorithm="maxima")
 
output
1/32*(sqrt(pi)*sqrt(2*c^2*log(f)^2 + 18*f^2)*(((-I*c^2*cos(3*d) - c^2*sin( 
3*d))*f^a*log(f)^2 + f^(a + 2)*(-I*cos(3*d) - sin(3*d)))*erf(sqrt(-c*log(f 
) + 3*I*f)*x) + ((I*c^2*cos(3*d) - c^2*sin(3*d))*f^a*log(f)^2 + f^(a + 2)* 
(I*cos(3*d) - sin(3*d)))*erf(sqrt(-c*log(f) - 3*I*f)*x))*sqrt(c*log(f) + s 
qrt(c^2*log(f)^2 + 9*f^2)) + 3*sqrt(pi)*sqrt(2*c^2*log(f)^2 + 2*f^2)*(((-I 
*c^2*cos(d) - c^2*sin(d))*f^a*log(f)^2 + 9*f^(a + 2)*(-I*cos(d) - sin(d))) 
*erf(sqrt(-c*log(f) + I*f)*x) + ((I*c^2*cos(d) - c^2*sin(d))*f^a*log(f)^2 
+ 9*f^(a + 2)*(I*cos(d) - sin(d)))*erf(sqrt(-c*log(f) - I*f)*x))*sqrt(c*lo 
g(f) + sqrt(c^2*log(f)^2 + f^2)) + sqrt(pi)*sqrt(2*c^2*log(f)^2 + 18*f^2)* 
(((c^2*cos(3*d) - I*c^2*sin(3*d))*f^a*log(f)^2 + f^(a + 2)*(cos(3*d) - I*s 
in(3*d)))*erf(sqrt(-c*log(f) + 3*I*f)*x) + ((c^2*cos(3*d) + I*c^2*sin(3*d) 
)*f^a*log(f)^2 + f^(a + 2)*(cos(3*d) + I*sin(3*d)))*erf(sqrt(-c*log(f) - 3 
*I*f)*x))*sqrt(-c*log(f) + sqrt(c^2*log(f)^2 + 9*f^2)) + 3*sqrt(pi)*sqrt(2 
*c^2*log(f)^2 + 2*f^2)*(((c^2*cos(d) - I*c^2*sin(d))*f^a*log(f)^2 + 9*f^(a 
 + 2)*(cos(d) - I*sin(d)))*erf(sqrt(-c*log(f) + I*f)*x) + ((c^2*cos(d) + I 
*c^2*sin(d))*f^a*log(f)^2 + 9*f^(a + 2)*(cos(d) + I*sin(d)))*erf(sqrt(-c*l 
og(f) - I*f)*x))*sqrt(-c*log(f) + sqrt(c^2*log(f)^2 + f^2)))/(c^4*log(f)^4 
 + 10*c^2*f^2*log(f)^2 + 9*f^4)
 
3.2.21.8 Giac [F]

\[ \int f^{a+c x^2} \cos ^3\left (d+f x^2\right ) \, dx=\int { f^{c x^{2} + a} \cos \left (f x^{2} + d\right )^{3} \,d x } \]

input
integrate(f^(c*x^2+a)*cos(f*x^2+d)^3,x, algorithm="giac")
 
output
integrate(f^(c*x^2 + a)*cos(f*x^2 + d)^3, x)
 
3.2.21.9 Mupad [F(-1)]

Timed out. \[ \int f^{a+c x^2} \cos ^3\left (d+f x^2\right ) \, dx=\int f^{c\,x^2+a}\,{\cos \left (f\,x^2+d\right )}^3 \,d x \]

input
int(f^(a + c*x^2)*cos(d + f*x^2)^3,x)
 
output
int(f^(a + c*x^2)*cos(d + f*x^2)^3, x)